{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "cb9e3f4a",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "[[-9.20173526e-02  6.29848316e-02 -4.18023467e-02 -1.01368606e-01\n",
      "  -1.01304211e-01 -1.10763028e-01 -3.28667015e-02  1.16141632e-01\n",
      "  -5.69480248e-02  7.51730129e-02 -8.93676057e-02 -2.59918477e-02\n",
      "   1.04260139e-01 -4.80853282e-02 -3.48158404e-02 -6.11628555e-02\n",
      "   4.74920832e-02  1.28951132e-01 -2.78207064e-01 -1.40801340e-01\n",
      "   1.32138491e-01 -3.42034213e-02 -5.60894012e-02 -4.15085582e-03\n",
      "   4.10656957e-03]\n",
      " [-7.48090148e-02 -7.86849707e-02  6.08136645e-03  4.33586799e-02\n",
      "  -1.60035066e-04  9.10728201e-02 -1.10223293e-01 -4.67501283e-02\n",
      "  -2.16872916e-02 -1.98207244e-01  1.15541600e-01 -1.43905461e-01\n",
      "  -1.19482450e-01 -4.85167578e-02  4.21402082e-02 -5.34742959e-02\n",
      "   1.59738213e-01 -2.13778745e-02 -1.33285925e-01 -3.40868463e-03\n",
      "   9.42437053e-02  2.82767578e-03 -7.95918480e-02 -3.19784582e-02\n",
      "   9.66512486e-02]\n",
      " [ 1.03912555e-01  1.37190744e-01  8.84817839e-02 -1.43219337e-01\n",
      "   5.88576570e-02 -4.28435858e-03 -5.76007143e-02 -1.59541324e-01\n",
      "   1.93698183e-01 -9.54285190e-02  1.08123915e-02  1.82209894e-01\n",
      "  -1.02819026e-01  6.67109266e-02 -7.99277201e-02  9.15825814e-02\n",
      "   1.47482067e-01  1.28391266e-01 -1.47133157e-01  5.17693833e-02\n",
      "   9.01240930e-02  4.58779894e-02 -1.78979710e-01  2.21631657e-02\n",
      "   2.85693649e-02]\n",
      " [-1.13703907e-01  5.22469059e-02  1.61875308e-01 -1.29267424e-01\n",
      "  -1.88688010e-01 -5.87728210e-02 -1.52735084e-01 -1.03216112e-01\n",
      "   2.13797793e-01 -1.09004499e-02  9.24889278e-03 -1.00025967e-01\n",
      "  -1.45476505e-01 -3.02904584e-02 -2.32662261e-02  4.76154909e-02\n",
      "  -8.57474059e-02 -1.19052388e-01 -1.24231018e-01 -1.84128866e-01\n",
      "  -4.44495156e-02  4.23427410e-02 -1.86556801e-02  8.98228139e-02\n",
      "  -6.40253499e-02]]\n",
      "<NDArray 4x25 @cpu(0)>\n",
      "epoch 1,loss 556088.500000\n",
      "epoch 2,loss 516903.343750\n",
      "epoch 3,loss 598289.125000\n",
      "epoch 4,loss 407861.937500\n",
      "epoch 5,loss 369146.187500\n",
      "epoch 6,loss 317679.531250\n",
      "epoch 7,loss 282600.718750\n",
      "epoch 8,loss 228588.781250\n",
      "epoch 9,loss 179438.828125\n",
      "epoch 10,loss 167680.093750\n",
      "epoch 11,loss 145607.734375\n",
      "epoch 12,loss 470476.593750\n",
      "epoch 13,loss 469979.531250\n",
      "epoch 14,loss 361502.125000\n",
      "epoch 15,loss 246061.421875\n",
      "epoch 16,loss 392625.593750\n",
      "epoch 17,loss 278801.187500\n",
      "epoch 18,loss 118493.515625\n",
      "epoch 19,loss 341716.437500\n",
      "epoch 20,loss 513550.312500\n",
      "epoch 21,loss 427164.312500\n",
      "epoch 22,loss 333606.937500\n",
      "epoch 23,loss 338233.250000\n",
      "epoch 24,loss 439746.968750\n",
      "epoch 25,loss 180833.703125\n",
      "epoch 26,loss 160711.140625\n",
      "epoch 27,loss 209976.546875\n",
      "epoch 28,loss 248178.046875\n",
      "epoch 29,loss 121205.609375\n",
      "epoch 30,loss 491700.687500\n",
      "epoch 31,loss 242147.281250\n",
      "epoch 32,loss 731186.000000\n",
      "epoch 33,loss 379656.718750\n",
      "epoch 34,loss 70722.250000\n",
      "epoch 35,loss 678583.062500\n",
      "epoch 36,loss 106696.421875\n",
      "epoch 37,loss 60027.953125\n",
      "epoch 38,loss 61325.511719\n",
      "epoch 39,loss 58638.570312\n",
      "epoch 40,loss 76391.000000\n",
      "epoch 41,loss 229477.718750\n",
      "epoch 42,loss 53222.843750\n",
      "epoch 43,loss 92863.718750\n",
      "epoch 44,loss 61396.957031\n",
      "epoch 45,loss 49221.218750\n",
      "epoch 46,loss 136889.875000\n",
      "epoch 47,loss 47239.972656\n",
      "epoch 48,loss 44047.726562\n",
      "epoch 49,loss 44479.898438\n",
      "epoch 50,loss 44879.867188\n"
     ]
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import d2lzh as d2l\n",
    "import xlrd\n",
    "import random\n",
    "import math\n",
    "from IPython import display\n",
    "from matplotlib import pyplot as plt\n",
    "from mxnet import autograd, nd\n",
    "batch_size = 3\n",
    "num_inputs = 4\n",
    "num_outputs = 1\n",
    "num_hiddens=25\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "w = nd.random.normal(scale=0.1, shape=(num_inputs, num_hiddens))\n",
    "b = nd.zeros(num_hiddens)\n",
    "w1=nd.random.normal(scale=0.1, shape=(num_hiddens, num_outputs))\n",
    "b1= nd.zeros(num_outputs)\n",
    "\n",
    "w.attach_grad()\n",
    "b.attach_grad()\n",
    "w1.attach_grad()\n",
    "b1.attach_grad()\n",
    "\n",
    "params=[w,b,w1,b1]\n",
    "print(w)\n",
    "def use_svg_display():\n",
    "    # 用矢量图显示\n",
    "    display.set_matplotlib_formats('svg')\n",
    "\n",
    "def set_figsize(figsize=(3.5, 2.5)):\n",
    "    use_svg_display()\n",
    "    # 设置图的尺寸\n",
    "    plt.rcParams['figure.figsize'] = figsize\n",
    "\n",
    "def squared_loss(y_hat, y):\n",
    "    return (y_hat - y) ** 2 / 2\n",
    "\n",
    "def relu(X):\n",
    "    return nd.maximum(X,0)\n",
    "\n",
    "def net(X):\n",
    "    H=relu(nd.dot(X,w)+b)\n",
    "    Y=nd.dot(H, w1) + b1\n",
    "    return Y\n",
    "\n",
    "def excel2matrix(path):\n",
    "    data = xlrd.open_workbook(path)\n",
    "    table = data.sheets()[0]\n",
    "    nrows = table.nrows  # 行数\n",
    "    ncols = table.ncols  # 列数\n",
    "    datamatrix = nd.random.normal(scale=1,shape=(nrows, ncols))\n",
    "    for i in range(nrows):\n",
    "        rows = table.row_values(i)\n",
    "        datamatrix[i,:] = rows\n",
    "    return datamatrix\n",
    " \n",
    "def data_iter(batch_size, features, labels):\n",
    "    num_examples = len(features)\n",
    "    indices = list(range(num_examples))\n",
    "    random.shuffle(indices)  # 样本的读取顺序是随机的\n",
    "    for i in range(0, num_examples, batch_size):\n",
    "        j = nd.array(indices[i: min(i + batch_size, num_examples)])\n",
    "        yield features.take(j), labels.take(j)  # take函数根据索引返回对应元素\n",
    "# def cross_entropy(y_hat, y):\n",
    "#     return -nd.pick(y_hat, y).log()\n",
    "# def accuracy(y_hat, y):\n",
    "#     return (y_hat.argmax(axis=1) == y.astype('float32')).mean().asscalar()\n",
    "\n",
    "# def evaluate_accuracy(data_iter, net):\n",
    "#     acc_sum, n = 0.0, 0\n",
    "#     for X, y in data_iter:\n",
    "#         y = y.astype('float32')\n",
    "#         acc_sum += (net(X).argmax(axis=1) == y).sum().asscalar()\n",
    "#         n += y.size\n",
    "#     return acc_sum / n\n",
    "\n",
    "num_epochs, lr = 50, 0.00001\n",
    "\n",
    "def sgd(params, lr, batch_size):  \n",
    "    for param in params:\n",
    "        param[:] = param - lr * param.grad / batch_size\n",
    "\n",
    "def train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,\n",
    "              params=None, lr=None):\n",
    "    for epoch in range(num_epochs):\n",
    "        for X, y in data_iter(batch_size,x,x_label):\n",
    "            with autograd.record():\n",
    "                y_hat = net(X)\n",
    "#                 print('X')\n",
    "#                 print(X)\n",
    "#                 print('y_hat')\n",
    "#                 print(y_hat)\n",
    "#                 print('y')\n",
    "#                 print(y)\n",
    "#                 print('[W,b]')\n",
    "#                 print([w,b])\n",
    "                l = loss(y_hat, y)\n",
    "            l.backward()   #求梯度\n",
    "            sgd(params, lr, batch_size)    #更新wb权重   \n",
    "#         print(params)\n",
    "        train_l_sum =loss(net(x),x_label)  #误差\n",
    "        print('epoch %d,loss %f' % (epoch + 1,train_l_sum.mean().asnumpy()))\n",
    "\n",
    "\n",
    "pathX = '309.xls'  #  113.xlsx 在当前文件夹下\n",
    "pathX2 = '309_label.xls'  #  113.xlsx 在当前文件夹下\n",
    "pathX3 = '309_pre.xls'  #  113.xlsx 在当前文件夹下\n",
    "x = excel2matrix(pathX)\n",
    "x_label=excel2matrix(pathX2)\n",
    "y_test=excel2matrix(pathX3)\n",
    "y_label=nd.zeros((y_test.shape[0],1))\n",
    "\n",
    "train_iter=data_iter(batch_size,x,x_label)\n",
    "test_iter=data_iter(batch_size,y_test,y_label)\n",
    "train_ch3(net, train_iter, test_iter, squared_loss, num_epochs, batch_size,params, lr)\n",
    "#set_figsize()\n",
    "#plt.scatter(x[:, 1].asnumpy(), x_label[:, 0].asnumpy(), 1);  # 加分号只显示图\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "e86025e9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[\n",
      "[[-5.68109226e+00  1.18156290e+01  4.02019644e+00 -1.01368606e-01\n",
      "  -1.01304211e-01 -1.10763028e-01 -3.28667015e-02  1.16141632e-01\n",
      "  -1.40818100e+01  7.51730129e-02 -8.93676057e-02  1.72897530e+01\n",
      "   1.04260139e-01  4.00264311e+00 -3.48158404e-02  3.08076286e+01\n",
      "   5.52603483e+00  1.00499554e+01 -2.78207064e-01 -1.40801340e-01\n",
      "   1.41673405e-02 -4.72952127e+00 -5.60894012e-02 -7.00517130e+00\n",
      "  -1.65935699e-02]\n",
      " [-6.24651604e+01  4.79172821e+01  1.64997711e+01  4.33586799e-02\n",
      "  -1.60035066e-04  9.10728201e-02 -1.10223293e-01 -4.67501283e-02\n",
      "  -1.13410015e+01 -1.98207244e-01  1.15541600e-01  7.47288208e+01\n",
      "  -1.19482450e-01  1.64812012e+01  4.21402082e-02  8.14564972e+01\n",
      "   2.26466370e+01  4.08074226e+01 -1.33285925e-01 -3.40868463e-03\n",
      "   8.70951712e-02 -3.95465374e+00 -7.95918480e-02 -5.82132483e+00\n",
      "   9.53541622e-02]\n",
      " [ 1.71315804e+01 -1.65728340e+01 -5.67304897e+00 -1.43219337e-01\n",
      "   5.88576570e-02 -4.28435858e-03 -5.76007143e-02 -1.59541324e-01\n",
      "   1.04732552e+01 -9.54285190e-02  1.08123915e-02 -2.55709801e+01\n",
      "  -1.02819026e-01 -5.64862919e+00 -7.99277201e-02 -2.47669868e+01\n",
      "  -7.77895975e+00 -1.41366396e+01 -1.47133157e-01  5.17693833e-02\n",
      "  -4.47863191e-02  3.52078032e+00 -1.78979710e-01  5.19010115e+00\n",
      "   4.24966216e-03]\n",
      " [-3.98802948e+01  1.95787010e+01  6.82971096e+00 -1.29267424e-01\n",
      "  -1.88688010e-01 -5.87728210e-02 -1.52735084e-01 -1.03216112e-01\n",
      "   1.32031012e+01 -1.09004499e-02  9.24889278e-03  3.16931610e+01\n",
      "  -1.45476505e-01  6.73104334e+00 -2.32662261e-02  2.58200741e+01\n",
      "   8.99295712e+00  1.65178967e+01 -1.24231018e-01 -1.84128866e-01\n",
      "  -6.85923770e-02  4.25650597e+00 -1.86556801e-02  6.47150898e+00\n",
      "  -6.89519346e-02]]\n",
      "<NDArray 4x25 @cpu(0)>, \n",
      "[ 2.3176332e+00 -2.2744012e+00 -7.8420150e-01  0.0000000e+00\n",
      "  0.0000000e+00  0.0000000e+00  0.0000000e+00  0.0000000e+00\n",
      "  1.3991518e+00  0.0000000e+00  0.0000000e+00 -3.5052686e+00\n",
      "  0.0000000e+00 -7.7791536e-01  0.0000000e+00 -3.3834989e+00\n",
      " -1.0788679e+00 -1.9416114e+00  0.0000000e+00  0.0000000e+00\n",
      " -1.8362653e-02  4.7296754e-01  0.0000000e+00  7.0340747e-01\n",
      " -3.3101542e-03]\n",
      "<NDArray 25 @cpu(0)>]\n"
     ]
    }
   ],
   "source": [
    "print([w,b])\n",
    "a=net(y_test)\n",
    "\n",
    "set_figsize()\n",
    "#plt.scatter(x[:, 1].asnumpy(), x_label[:, 0].asnumpy(), 1);  # 加分号只显示图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "77210598",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1283.8838  ]\n",
      " [1062.4021  ]\n",
      " [1062.4021  ]\n",
      " [1062.4021  ]\n",
      " [1041.3083  ]\n",
      " [1041.3083  ]\n",
      " [ 972.7548  ]\n",
      " [ 978.0274  ]\n",
      " [ 967.4805  ]\n",
      " [ 967.4805  ]\n",
      " [ 967.4805  ]\n",
      " [ 951.6612  ]\n",
      " [ 951.6612  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1092.1998  ]\n",
      " [1092.1998  ]\n",
      " [1092.1998  ]\n",
      " [1092.1998  ]\n",
      " [1092.1998  ]\n",
      " [1102.7462  ]\n",
      " [1102.7462  ]\n",
      " [1102.7462  ]\n",
      " [1097.4727  ]\n",
      " [1097.4727  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1123.8398  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1155.4799  ]\n",
      " [1144.9329  ]\n",
      " [1144.9329  ]\n",
      " [1144.9329  ]\n",
      " [1144.9329  ]\n",
      " [1144.9329  ]\n",
      " [1144.9329  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1139.6595  ]\n",
      " [1134.387   ]\n",
      " [1134.387   ]\n",
      " [1134.387   ]\n",
      " [1134.387   ]\n",
      " [1134.387   ]\n",
      " [1150.2065  ]\n",
      " [1150.2065  ]\n",
      " [1150.2065  ]\n",
      " [1150.2065  ]\n",
      " [1150.2065  ]\n",
      " [1166.0267  ]\n",
      " [1166.0267  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1129.1134  ]\n",
      " [1008.74664 ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 904.2004  ]\n",
      " [ 888.38007 ]\n",
      " [ 888.38007 ]\n",
      " [ 888.38007 ]\n",
      " [ 909.4737  ]\n",
      " [ 909.4737  ]\n",
      " [ 909.4737  ]\n",
      " [ 909.4737  ]\n",
      " [ 930.56757 ]\n",
      " [ 930.56757 ]\n",
      " [ 930.56757 ]\n",
      " [ 951.6612  ]\n",
      " [ 951.6612  ]\n",
      " [ 951.6612  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 962.20807 ]\n",
      " [ 962.20807 ]\n",
      " [ 972.7548  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 972.7548  ]\n",
      " [ 972.7548  ]\n",
      " [ 983.3018  ]\n",
      " [ 983.3018  ]\n",
      " [ 951.6612  ]\n",
      " [ 951.6612  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 935.8409  ]\n",
      " [ 935.8409  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 941.1143  ]\n",
      " [ 941.1143  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 946.3879  ]\n",
      " [ 930.56757 ]\n",
      " [ 930.56757 ]\n",
      " [ 930.56757 ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 956.9345  ]\n",
      " [ 930.56757 ]\n",
      " [ 930.56757 ]\n",
      " [ 935.8409  ]\n",
      " [ 935.8409  ]\n",
      " [ 935.8409  ]\n",
      " [ 935.8409  ]\n",
      " [ 935.8409  ]\n",
      " [ 935.8409  ]\n",
      " [1009.6679  ]\n",
      " [1009.6679  ]\n",
      " [1009.6679  ]\n",
      " [1020.21466 ]\n",
      " [1020.21466 ]\n",
      " [1036.035   ]\n",
      " [1036.035   ]\n",
      " [1041.3083  ]\n",
      " [1041.3083  ]\n",
      " [1041.3083  ]\n",
      " [1041.3083  ]\n",
      " [1046.5817  ]\n",
      " [1046.5817  ]\n",
      " [1046.5817  ]\n",
      " [1062.4021  ]\n",
      " [1062.4021  ]\n",
      " [1051.8551  ]\n",
      " [1051.8551  ]\n",
      " [1025.488   ]\n",
      " [1025.488   ]\n",
      " [1025.488   ]\n",
      " [ 973.2152  ]\n",
      " [ 973.2152  ]\n",
      " [ 973.2152  ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 952.12164 ]\n",
      " [ 941.57526 ]\n",
      " [ 941.57526 ]\n",
      " [ 941.57526 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 931.02826 ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 962.6683  ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 957.39484 ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 904.6613  ]\n",
      " [ 883.56757 ]\n",
      " [ 883.56757 ]\n",
      " [ 883.56757 ]\n",
      " [ 883.56757 ]\n",
      " [ 883.56757 ]\n",
      " [ 883.56757 ]\n",
      " [ 684.56134 ]\n",
      " [ 684.56134 ]\n",
      " [ 684.56134 ]\n",
      " [ 684.56134 ]\n",
      " [ 684.56134 ]\n",
      " [ 684.56134 ]\n",
      " [ 794.38116 ]\n",
      " [ 794.38116 ]\n",
      " [ 794.38116 ]\n",
      " [ 799.6546  ]\n",
      " [ 815.4748  ]\n",
      " [ 804.92804 ]\n",
      " [ 804.92804 ]\n",
      " [ 794.38116 ]\n",
      " [ 794.38116 ]\n",
      " [ 794.38116 ]\n",
      " [ 799.6546  ]\n",
      " [ 799.6546  ]\n",
      " [ 799.6546  ]\n",
      " [ 799.6546  ]\n",
      " [ 778.56134 ]\n",
      " [ 778.56134 ]\n",
      " [ 778.56134 ]\n",
      " [ 778.56134 ]\n",
      " [ 778.56134 ]\n",
      " [ 778.56134 ]\n",
      " [ 778.56134 ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 783.8344  ]\n",
      " [ 569.4693  ]\n",
      " [ 569.4693  ]\n",
      " [ 595.83575 ]\n",
      " [ 595.83575 ]\n",
      " [ 595.83575 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 627.01495 ]\n",
      " [ 627.01495 ]\n",
      " [ 627.01495 ]\n",
      " [ 632.28827 ]\n",
      " [ 632.28827 ]\n",
      " [ 574.74225 ]\n",
      " [ 574.74225 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 580.01544 ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 595.612   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 585.289   ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 638.2459  ]\n",
      " [ 643.51984 ]\n",
      " [ 643.51984 ]\n",
      " [ 643.51984 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 627.69965 ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [-417.76215 ]\n",
      " [-417.76215 ]\n",
      " [-417.76215 ]\n",
      " [-417.76215 ]\n",
      " [-417.76215 ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 523.1534  ]\n",
      " [ 502.52057 ]\n",
      " [ 502.52057 ]\n",
      " [ 491.97357 ]\n",
      " [ 491.97357 ]\n",
      " [ 538.9736  ]\n",
      " [ 502.52057 ]\n",
      " [ 502.52057 ]\n",
      " [ 502.52057 ]\n",
      " [ 502.52057 ]\n",
      " [ 502.52057 ]\n",
      " [ 470.88043 ]\n",
      " [ 470.88043 ]\n",
      " [ 470.88043 ]\n",
      " [ 460.33344 ]\n",
      " [ 613.2613  ]\n",
      " [ 613.2613  ]\n",
      " [ 518.34064 ]\n",
      " [ 518.34064 ]\n",
      " [ 518.34064 ]\n",
      " [ 481.42682 ]\n",
      " [ 481.42682 ]\n",
      " [ 476.15387 ]\n",
      " [ 476.15387 ]\n",
      " [ 460.10992 ]\n",
      " [ 455.06012 ]\n",
      " [ 455.06012 ]\n",
      " [ 455.06012 ]\n",
      " [ 460.33344 ]\n",
      " [ 460.33344 ]\n",
      " [ 460.33344 ]\n",
      " [ 455.06012 ]\n",
      " [ 455.06012 ]\n",
      " [ 455.06012 ]\n",
      " [  36.875538]\n",
      " [ 393.16193 ]\n",
      " [ 445.435   ]\n",
      " [ 445.435   ]\n",
      " [ 445.435   ]\n",
      " [ 455.98175 ]\n",
      " [ 445.435   ]\n",
      " [ 586.4339  ]\n",
      " [ 329.19684 ]\n",
      " [ 329.19684 ]\n",
      " [ 480.74274 ]\n",
      " [ 480.74274 ]\n",
      " [ 479.87103 ]\n",
      " [ 479.87103 ]\n",
      " [ 539.764   ]\n",
      " [ 539.764   ]\n",
      " [ 477.2126  ]\n",
      " [ 477.2126  ]\n",
      " [ 626.7674  ]\n",
      " [ 626.7674  ]\n",
      " [ 428.30634 ]\n",
      " [ 512.65375 ]\n",
      " [ 433.26825 ]\n",
      " [ 438.22968 ]\n",
      " [ 398.53705 ]\n",
      " [ 398.53705 ]\n",
      " [ 433.26825 ]\n",
      " [ 433.26825 ]\n",
      " [ 398.53705 ]\n",
      " [ 398.53705 ]\n",
      " [ 398.53705 ]\n",
      " [ 398.53705 ]\n",
      " [ 398.53705 ]\n",
      " [ 398.53705 ]\n",
      " [ 408.46027 ]\n",
      " [ 408.46027 ]\n",
      " [ 433.26825 ]\n",
      " [ 433.26825 ]\n",
      " [ 490.50262 ]\n",
      " [ 490.50262 ]\n",
      " [ 438.22968 ]\n",
      " [ 438.22968 ]\n",
      " [ 428.30634 ]\n",
      " [ 428.30634 ]\n",
      " [ 455.77216 ]\n",
      " [ 455.77216 ]\n",
      " [ 520.2724  ]\n",
      " [ 520.2724  ]\n",
      " [ 455.77216 ]\n",
      " [ 455.77216 ]\n",
      " [ 520.2724  ]\n",
      " [ 520.2724  ]\n",
      " [ 520.2724  ]\n",
      " [ 520.2724  ]\n",
      " [ 552.6994  ]\n",
      " [ 552.6994  ]\n",
      " [ 515.311   ]\n",
      " [ 515.311   ]\n",
      " [ 555.00397 ]\n",
      " [ 654.23285 ]\n",
      " [ 654.23285 ]\n",
      " [ 654.23285 ]\n",
      " [ 654.23285 ]\n",
      " [ 654.23285 ]\n",
      " [ 654.23285 ]\n",
      " [ 654.23285 ]\n",
      " [ 520.2724  ]\n",
      " [ 520.2724  ]\n",
      " [ 520.2724  ]\n",
      " [ 535.15753 ]\n",
      " [ 535.15753 ]\n",
      " [ 535.15753 ]\n",
      " [ 515.311   ]\n",
      " [ 515.311   ]\n",
      " [ 559.965   ]\n",
      " [ 559.965   ]\n",
      " [ 559.965   ]\n",
      " [ 559.965   ]\n",
      " [ 545.08075 ]\n",
      " [ 545.08075 ]\n",
      " [ 485.54156 ]\n",
      " [ 485.54156 ]\n",
      " [ 537.81464 ]\n",
      " [ 537.81464 ]\n",
      " [ 532.8532  ]\n",
      " [ 532.8532  ]\n",
      " [ 537.81464 ]\n",
      " [ 537.81464 ]\n",
      " [ 522.9296  ]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "a1=a.asnumpy()\n",
    "print(a1)\n",
    "np.savetxt(\"./result.txt\",a1,fmt='%d')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c52cd1fa",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:gluon] *",
   "language": "python",
   "name": "conda-env-gluon-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
